package cn.kgc.lqy.demo.mapper;

import cn.kgc.lqy.demo.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface StudentMapper {

    @Select("select * from student")
    List<Student> selectAll();

    @Insert("Insert into student values (null,#{sname},#{sage},#{sex})")
    int insertStu(Student student);

    @Update("UPDATE student SET sname=#{sname} ,sage=#{sage},sex=#{sex} WHERE sid=#{sid};")
    int updateStu(Student student);

    @Delete("Delete from student where sid = #{sid}")
    int deleteStu(Integer sid);
}
